package com.xish.api.activity.search.query;

import com.mysema.query.sql.MySQLTemplates;
import com.mysema.query.sql.SQLQuery;
import com.xish.api.activity.search.ActivitySearchCondition;
import com.xish.model.table.QWzmActivitySearch;

import java.util.List;

public class ActivityHighlightRuleFour extends ActivitySearchSqlQuery {

    public static final int limit = 2;

    public ActivityHighlightRuleFour(ActivitySearchCondition condition, List<Integer> excludeIdList) {
        super(condition, excludeIdList);
    }

    @Override
    public SQLQuery getSQLQuery() {
        SQLQuery query = new SQLQuery(new MySQLTemplates());

        query.from(QWzmActivitySearch.wzmActivitySearch)
                .where(status()
                        .and(isShowWeek())
                        .and(createTime())
                        .and(showEndTime())
                        .and(cityPoiId())
                        .and(scheduleType())
                        .and(idNotIn(excludeIdList)))
                .orderBy(sortDayFollowNum())
                .limit(limit);

        return query;
    }
}
